'''欢迎来到LangChain实战课
https://time.geekbang.org/column/intro/100617601
作者 黄佳'''

import os

os.environ["OPENAI_API_BASE"] = 'https://api.deepseek.com/v1'
from langchain_openai import ChatOpenAI
chat = ChatOpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),
    base_url="https://api.deepseek.com/v1",
    model="deepseek-chat",
    temperature=0.8,
    max_tokens=60
)
from langchain_core.messages import HumanMessage, SystemMessage
messages = [
    SystemMessage(content="你是一个很棒的智能助手"),
    HumanMessage(content="请给我的花店起个名")
]
response = chat.invoke(messages)
print(response.content)